Skip to content

Add SYCL support for geometry and pipelines kernels, Transform ops, Nearest neighbor search and HashMap - #7443

Merged
ssheorey merged 50 commits into
mainfrom
copilot/add-sycl-kernels-for-cuda
Jul 21, 2026
Merged

Add SYCL support for geometry and pipelines kernels, Transform ops, Nearest neighbor search and HashMap#7443
ssheorey merged 50 commits into
mainfrom
copilot/add-sycl-kernels-for-cuda

Conversation

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Port missing CUDA kernels to SYCL and fix all "Unimplemented device" errors for SYCL tensors in the t/pipelines and t/geometry subsystems.

Type

  • New feature (non-breaking change which adds functionality). Resolves #

Motivation and Context

SYCL:0 devices hit utility::LogError("Unimplemented device") in several hot paths:

  • Transform{Points,Normals} / Rotate{Points,Normals} — no SYCL dispatch in Transform.cpp
  • EstimateNormals, EstimateColorGradients, RemoveRadiusOutliers, RemoveStatisticalOutliers, ComputeBoundaryPointsNearestNeighborSearch asserts non-SYCL
  • All t/pipelines/kernel functions (ComputeFPFHFeature, ComputePosePoint*, FillInLinearSystem, RGBDOdometry, TransformationConverter) — no SYCL kernels existed

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

New SYCL pipeline kernels (t/pipelines/kernel/)

Five new *SYCL.cpp files implement SYCL equivalents of every CUDA kernel:

File Functions
FeatureSYCL.cpp ComputeFPFHFeatureSYCL
FillInLinearSystemSYCL.cpp FillInRigidAlignmentTermSYCL, FillInSLACAlignmentTermSYCL, FillInSLACRegularizerTermSYCL
RegistrationSYCL.cpp ComputePosePointToPointSYCL, ComputePosePointToPlaneSYCL, ComputeColoredICPResidualAndGradientSYCL, ComputePointToPlaneDistancesSYCL
RGBDOdometrySYCL.cpp All four RGBD odometry pose solvers
TransformationConverterSYCL.cpp Pose↔transformation converters

Kernels use sycl::nd_range + sycl::reduce_over_group for reduction paths (matching CUDA's cub::BlockReduce) instead of plain global atomics, and sycl::local_accessor for shared local memory.

New SYCL geometry kernel (t/geometry/kernel/)

TransformSYCL.cpp — SYCL implementations of TransformPoints, TransformNormals, RotatePoints, RotateNormals via sycl::queue::parallel_for. Reuses the existing TransformImpl.h per-element kernels, guarded by a new OPEN3D_SKIP_TRANSFORM_MAIN macro (mirrors OPEN3D_SKIP_FPFH_MAIN in FeatureImpl.h) to avoid duplicate symbol errors.

Transform.cpp and Transform.h updated with IsSYCL() dispatch branches.

NNS CPU fallback for SYCL devices (t/geometry/PointCloud.cpp, t/pipelines/registration/)

NearestNeighborSearch explicitly rejects SYCL tensors. Every NNS call site now transparently redirects to CPU when device.IsSYCL():

const core::Device nns_device = device.IsSYCL() ? core::Device("CPU:0") : device;
const core::Tensor positions_nns = GetPointPositions().To(nns_device);
core::nns::NearestNeighborSearch nns(positions_nns);
// ... run NNS ...
indices = indices.To(device);  // bring results back for SYCL kernels

Affected: EstimateNormals (Hybrid/KNN/Radius), EstimateColorGradients (Hybrid/KNN/Radius), RemoveRadiusOutliers, RemoveStatisticalOutliers, ComputeBoundaryPoints, ComputeFPFHFeature, CorrespondencesFromFeatures, EvaluateRegistration, MultiScaleICP, GetInformationMatrix.

Test coverage

All t/pipelines tests (Registration, Feature, TransformationEstimation, RGBDOdometry, TransformationConverter, SLAC) updated to use PermuteDevicesWithSYCL so SYCL:0 is exercised in CI.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@update-docs

update-docs Bot commented Feb 20, 2026

Copy link
Copy Markdown

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

Copilot AI and others added 2 commits February 20, 2026 13:01
… Registration, RGBDOdometry, TransformationConverter

Co-authored-by: ssheorey <41028320+ssheorey@users.noreply.github.com>
…L declaration

Co-authored-by: ssheorey <41028320+ssheorey@users.noreply.github.com>
Copilot AI changed the title [WIP] Add equivalent SYCL kernels for existing CUDA kernels Add SYCL kernels for t/pipelines: Feature, FillInLinearSystem, Registration, RGBDOdometry, TransformationConverter Feb 20, 2026
Copilot AI requested a review from ssheorey February 20, 2026 13:07
… to SYCL kernel files

Co-authored-by: ssheorey <41028320+ssheorey@users.noreply.github.com>
Copilot AI changed the title Add SYCL kernels for t/pipelines: Feature, FillInLinearSystem, Registration, RGBDOdometry, TransformationConverter Add SYCL kernels for t/pipelines/kernel (Feature, FillInLinearSystem, Registration, RGBDOdometry, TransformationConverter) Feb 23, 2026
…e coverage

Co-authored-by: ssheorey <41028320+ssheorey@users.noreply.github.com>
Copilot AI changed the title Add SYCL kernels for t/pipelines/kernel (Feature, FillInLinearSystem, Registration, RGBDOdometry, TransformationConverter) Add SYCL kernels for t/pipelines (Feature, FillInLinearSystem, Registration, RGBDOdometry, TransformationConverter) and enable SYCL test coverage Mar 13, 2026
…ead of plain global atomics

Co-authored-by: ssheorey <41028320+ssheorey@users.noreply.github.com>
Copilot AI changed the title Add SYCL kernels for t/pipelines (Feature, FillInLinearSystem, Registration, RGBDOdometry, TransformationConverter) and enable SYCL test coverage Optimize SYCL pipeline kernels: group reduction instead of plain global atomics Mar 13, 2026
Copilot AI changed the title Optimize SYCL pipeline kernels: group reduction instead of plain global atomics Add SYCL support for NNS-dependent operations via CPU fallback Mar 14, 2026
ssheorey and others added 7 commits June 29, 2026 10:31
SYCL nearest-neighbor search
- Refactor tiled KNN/radius/hybrid into KnnSearchOpsSYCL.cpp + KnnSearchSYCLImpl.h
  so AddMM stays in the driver while top-K, count, and gather kernels are reusable
  and documented (small-k fused heap path vs legacy select/merge for large k).
- Add configurable tile_bytes on KnnIndex/FixedRadiusIndex (defaults in
  NeighborSearchCommon.h) because integrated vs discrete Intel GPUs need
  different distance-tile sizes to stay cache-friendly without blowing memory.
- Implement fused UpdateTopKFromTile for k ≤ 512, per-query threshold handling
  for radius/hybrid (radius² − |q|²), and finalize/clamp rules (C1/C4) so
  distances are non-negative and ties break by index like CPU/CUDA.
- Extend C++/Python SYCL NNS tests (parity, coincident query, tie-break, radius,
  hybrid) to lock in correctness after the algorithm rewrite.
SYCL hash map backend
- Pack slot state, buf_index, and fingerprint into one uint64 per bucket to cut
  probe traffic and skip key-buffer loads on fingerprint mismatch.
- Use power-of-two buckets with HashMix (fmix64) so probing uses masks instead
  of 64-bit modulo on GPU, and reserve/rehash when tombstones fill the table
  (GetNonEmptyCount + HashMap::Insert/Activate checks), not only live size.
- Harden Insert for Intel Xe L1 coherence (seq_cst fences, LOCKED slots,
  restart-on-LOCKED instead of subgroup spin) to avoid stale keys and hangs.
- Vectorize value copies via SYCLBlockCopyDispatch; improve GetActiveIndices
  with work-group scan + one atomic per group instead of per-slot atomics.
- SYCLHashDeviceLookup uses plain loads when the table is read-only during
  raycast-style kernels.
Core SYCL utilities
- Add SYCLBlockCopyDispatch.h and use it in CopySYCL for object dtypes so
  copies use wide vector loads/stores instead of per-element queue.memcpy.
Build and tooling (SYCL-without-CUDA / local dev)
- Gate OPEN3D_CUDA_COMPILER_* defines and CompilerInfo CUDA strings on
  BUILD_CUDA_MODULE so SYCL-only builds do not reference undefined CUDA macros.
- Add ENABLE_SANITIZER CMake option and wire -fsanitize into Open3D when set.
- Comment out optional EGL/X11 linking block in cpp/open3d/CMakeLists.txt
  (local build adjustment—confirm this is intended before upstreaming).
Some optimizations. (e.g. restrict)
lock free hashmap insert: write buffer then CAS design is correct and fast, but leaves holes in the data buffer.
Center data before Knn, if using expanded L2 distance formula (p^2+q^2-2pq) to prevent cancellation
bug in indexer: TensorIterator::GetPtr() incorrect for non-contiguous.
Added Knn search benchmark
- SYCLContext: process-wide static singleton (was thread_local) to avoid
  per-thread SYCL contexts/USM mismatches; cache all device properties in
  one place (SYCLContext::Impl) and expose via GetDeviceProperties().
- Add SYCL launch helpers (SYCLPreferredWorkGroupSize, SYCLNdRange1D,
  group-reduction helpers) and use nd_range<1> + sycl::reduce_over_group
  across ParallelFor, elementwise, and reduction kernels instead of flat
  parallel_for(n) / per-output kernel launches.
- ReductionSYCL: on-device GetInputPtrDevice() enables one kernel with one
  work-group per output for multi-output reductions (incl. arg-reductions).
- Registration/RGBD odometry/SLAC kernels: accumulate AtA/Atb/residual in
  SLM per work-group (restrict-qualified pointers) instead of global atomics.
- Rename SYCLBlockCopyDispatch.h -> BlockCopyDispatch.h, generalize the
  vectorized object-copy dispatch (up to 64-byte blocks) shared by the hash
  map and tensor copy paths; align CUDA hashmap Dispatch.h divisors to match.
- Build: set -fsycl-max-parallel-link-jobs, prefer lld linker when available.
- Update ParallelFor/Reduction benchmarks and Linalg/Tensor tests for the
  refactored SYCLContext API.
Add core::sy::IsCPUDevice() to detect the SYCL CPU fallback device and
use it to throw clear errors from LeastSquaresSYCL (gels_batch), the
SYCL hash map, and FixedRadiusSearch/HybridSearch, which are broken on
SYCL CPU. Skip the corresponding C++ tests (HashMap, NNS, VoxelBlockGrid,
Registration, Feature, PointCloud) and opt affected Python tests out of
the SYCL CPU fallback via list_devices(also_sycl_cpu=False).
@ssheorey
ssheorey marked this pull request as ready for review July 7, 2026 06:59
@ssheorey ssheorey changed the title Add SYCL support for t/geometry/t/pipelines kernels, Transform ops, and NNS CPU fallback Add SYCL support for geometry and pipelines kernels, Transform ops, Nearest neighbor search and HashMap Jul 7, 2026
ssheorey and others added 17 commits July 7, 2026 23:14
…e formatting

- Guard IntegrateFrames() with #ifdef BUILD_SYCL_MODULE in
  cpp/tests/t/geometry/VoxelBlockGrid.cpp since it is only used by
  SYCL-gated tests, fixing unused-function-as-error in non-SYCL builds.
- Apply repo clang-format/yapf style fixes to files touched by this PR.
- SYCL CPU fallback: Restored IsCPUDevice guards for FixedRadiusSearch
  and HybridSearch (and their dependent modules: NearestNeighborSearch,
  PointCloud, Registration, Feature) due to large-scale segmentation
  faults on SYCL CPU. HashMap and VoxelBlockGrid are now fully supported
  on SYCL CPU.
- MSVC preprocessor: Fixed compilation error in PointCloudImpl.h by
  replacing nested #if/#elif inside lambda with OPEN3D_ATOMIC_ADD.
- CUDA compilation: Resolved BlockCopy64 template argument error in
  SlabHashBackend/StdGPUHashBackend by moving struct to namespace scope,
  and brought global isnan into trianglemesh namespace.
- Benchmarks: Explicitly linked Open3D::3rdparty_sycl to benchmarks
  target to resolve DSO link errors.
- Tests: Updated Python and C++ test suites to run cleanly with
  ONEAPI_DEVICE_SELECTOR=opencl:cpu and when SYCL is disabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
… make CMake link options private

This prevents runtime crashes on CPU devices, improves performance by caching contiguity, and avoids propagating build-time options to downstream consumers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This cleans up the PR's diff and ensures compliance with the CI's style-checking rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
…brid NNS

Replace the O(N*M) tiled-AddMM brute force in FixedRadiusSearchSYCL and
HybridSearchSYCL with a shared spatial-hash CSR grid (cell size 2*radius),
mirroring CUDA's FixedRadiusSearchImpl.cuh: count -> oneDPL inclusive_scan
-> scatter to build the grid, then a two-pass count/gather (radius) or
single-pass top-max_knn (hybrid) over the 8 corner-adjacent hash bins per
query. sort=true uses an on-device oneDPL sort_by_key (packed uint64 radix
key for float, struct key + comparator for double).

This also removes the SYCL-CPU restriction for FixedRadius/Hybrid search,
since the grid algorithm (unlike the old AddMM path) has no GPU-specific
sizing dependency; verified by unskipping and passing the previously
CPU-guarded C++/Python parity tests, plus EstimateNormals/
RemoveRadiusOutliers end-to-end on SYCL:0 CPU fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ign note

Fixes the style-check CI failure (line-wrapping only, no logic changes).
Also adds docs/cuda_vs_sycl_nns_hashmap.md summarizing how the SYCL and
CUDA core::nns/core::HashMap implementations compare after the
fixed-radius/hybrid grid port.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pre-reserve one heap slot per insert thread on the host (CUDA SlabHash-style)
and DeviceFree slots that lose the CAS or hit a duplicate; avoids in-kernel Allocate/Free races.
RaycastingScene: dedupe ray-triangle hits by (geomID, tfar) instead of
(geomID, primID, tfar), since Embree's SYCL/GPU filter callback does not
reliably refresh primID across successive candidate hits for one ray,
causing genuinely distinct intersections to be dropped.

ParallelFor: guard the non-vectorized overload with device.IsSYCL() before
dispatching to ParallelForSYCL_, matching the vectorized overload, so CPU
devices don't crash when called from a SYCL-compiled translation unit.

Also includes prior fixes from this session: SYCL reduction_prod tree
reduction, KnnSearchSYCL large-k distance clamping, a TensorFunction
tail-call stack-unwinding crash, and enabling SYCL devices by default in
Python test parametrization.

Co-authored-by: Cursor <cursoragent@cursor.com>
Consolidate shared registration/transform/feature logic, SYCLUtils helpers,
and hashmap buf_indices handling; expand in-source NNS/hash documentation and
refresh C++/Python SYCL tests (drop redundant voxel block grid Python test).

Co-authored-by: Cursor <cursoragent@cursor.com>
Guard ComputeRtPointToPointTensor when neither CUDA nor SYCL is built; apply
style; skip SYCL-only C4 tie-break on CUDA; defer Windows SYCL VoxelBlockGrid
golden tests; add CHANGELOG entry for SYCL tensor backends.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ssheorey
ssheorey merged commit d206cdb into main Jul 21, 2026
22 of 23 checks passed
@ssheorey
ssheorey deleted the copilot/add-sycl-kernels-for-cuda branch July 21, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status / to merge Looks good, merge after minor updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants